package com.ra.landlord;

import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToOne;
import javax.persistence.Transient;

import com.googlecode.cswish.annotation.cm;

@Entity
@DiscriminatorValue("8")
@cm("房东管理员")
public class LandlordAssistUser extends LandlordUser {

	private LandlordOwnerUser landlordOwnerUser;
	
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinTable(name = "ra_landlorduser_landlordpermission", 
		joinColumns = @JoinColumn(name="user_id"),						// assist id
		inverseJoinColumns = @JoinColumn(name="administrator_id"))		// landlord id
	public LandlordOwnerUser getLandlordOwnerUser() {
		return landlordOwnerUser;
	}

	public void setLandlordOwnerUser(LandlordOwnerUser landlordOwnerUser) {
		this.landlordOwnerUser = landlordOwnerUser;
	}


	@Override
	@Transient
	public LandlordOwnerUser getOwnerUser() {
		return getLandlordOwnerUser();
	}
}
